{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2.4.1'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "# import tensorflow.keras.backend as KTF\n",
    "\n",
    "# config = tf.ConfigProto()  \n",
    "# config.gpu_options.allow_growth=True   \n",
    "# session = tf.Session(config=config)\n",
    "# KTF.set_session(session)\n",
    "tf.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "FEATURES = ['rsi_6', 'rsi_12', 'rsi_24', 'stoch_k', 'stoch_d', 'stoch_j', 'BBP', 'BLOW_HIGH', 'macd', 'macdsignal', 'macdhist', 'SMA_DIFF_5', 'SMA_DIFF_13', 'SMA_DIFF_21', 'SMA_DIFF_34', 'SMA_DIFF_55', 'SMA_DIFF_89', 'SMA_DIFF_144', 'SMA_DIFF_233', 'SMA_DIFF_377', 'SMA_5_13_DIFF', 'SMA_5_21_DIFF', 'SMA_5_34_DIFF', 'SMA_5_55_DIFF', 'SMA_5_89_DIFF', 'SMA_5_144_DIFF', 'SMA_5_233_DIFF', 'SMA_5_377_DIFF', 'SMA_13_21_DIFF', 'SMA_13_34_DIFF', 'SMA_13_55_DIFF', 'SMA_13_89_DIFF', 'SMA_13_144_DIFF', 'SMA_13_233_DIFF', 'SMA_13_377_DIFF', 'SMA_21_34_DIFF', 'SMA_21_55_DIFF', 'SMA_21_89_DIFF', 'SMA_21_144_DIFF', 'SMA_21_233_DIFF', 'SMA_21_377_DIFF', 'SMA_34_55_DIFF', 'SMA_34_89_DIFF', 'SMA_34_144_DIFF', 'SMA_34_233_DIFF', 'SMA_34_377_DIFF', 'SMA_55_89_DIFF', 'SMA_55_144_DIFF', 'SMA_55_233_DIFF', 'SMA_55_377_DIFF', 'SMA_89_144_DIFF', 'SMA_89_233_DIFF', 'SMA_89_377_DIFF', 'SMA_144_233_DIFF', 'SMA_144_377_DIFF', 'SMA_233_377_DIFF', 'peTTM_377_SMA_diff', 'pbMRQ_377_SMA_diff', 'psTTM_377_SMA_diff', 'pcfNcfTTM_377_SMA_diff', 'VOL_SMA_DIFF_5', 'VOL_SMA_DIFF_13', 'VOL_SMA_DIFF_21', 'VOL_SMA_DIFF_34', 'VOL_SMA_DIFF_55', 'VOL_SMA_DIFF_89', 'VOL_SMA_DIFF_144', 'VOL_SMA_DIFF_233', 'VOL_SMA_DIFF_377']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "No files match b.csv.",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-3-bcab9c9bf412>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mCSV_COLUMNS\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mFEATURES\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'target'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mLABEL_COLUMN\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'target'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m dataset = tf.data.experimental.make_csv_dataset(\n\u001b[0m\u001b[1;32m      4\u001b[0m          \u001b[0;34m\"b.csv\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m          \u001b[0mcolumn_names\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mCSV_COLUMNS\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/envs/tf24/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/readers.py\u001b[0m in \u001b[0;36mmake_csv_dataset_v2\u001b[0;34m(file_pattern, batch_size, column_names, column_defaults, label_name, select_columns, field_delim, use_quote_delim, na_value, header, num_epochs, shuffle, shuffle_buffer_size, shuffle_seed, prefetch_buffer_size, num_parallel_reads, sloppy, num_rows_for_inference, compression_type, ignore_errors)\u001b[0m\n\u001b[1;32m    436\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    437\u001b[0m   \u001b[0;31m# Create dataset of all matching filenames\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 438\u001b[0;31m   \u001b[0mfilenames\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_get_file_names\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfile_pattern\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    439\u001b[0m   \u001b[0mdataset\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdataset_ops\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDataset\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_tensor_slices\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilenames\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    440\u001b[0m   \u001b[0;32mif\u001b[0m \u001b[0mshuffle\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/opt/anaconda3/envs/tf24/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/readers.py\u001b[0m in \u001b[0;36m_get_file_names\u001b[0;34m(file_pattern, shuffle)\u001b[0m\n\u001b[1;32m   1103\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1104\u001b[0m   \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mfile_names\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1105\u001b[0;31m     \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"No files match %s.\"\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mfile_pattern\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1107\u001b[0m   \u001b[0;31m# Sort files so it will be deterministic for unit tests.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mValueError\u001b[0m: No files match b.csv."
     ]
    }
   ],
   "source": [
    "CSV_COLUMNS = FEATURES + ['target']\n",
    "LABEL_COLUMN = 'target'\n",
    "dataset = tf.data.experimental.make_csv_dataset(\n",
    "         \"b.csv\",\n",
    "         column_names=CSV_COLUMNS,\n",
    "        label_name=LABEL_COLUMN,\n",
    "        batch_size = 128\n",
    "     )\n",
    "# 693435\n",
    "train_size = 600000\n",
    "test_size = 40000\n",
    "full_dataset = dataset.shuffle(buffer_size = 128)\n",
    "train_dataset = dataset.take(train_size)\n",
    "test_dataset = dataset.skip(train_size)\n",
    "val_dataset = test_dataset.skip(test_size)\n",
    "test_dataset = test_dataset.take(test_size)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "categorical_columns = []\n",
    "# is sz50 hs300 zz500 \n",
    "# industry"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "numerical_columns = []\n",
    "\n",
    "for feature in FEATURES:\n",
    "  num_col = tf.feature_column.numeric_column(feature)\n",
    "  numerical_columns.append(num_col)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.feature_column.dense_features_v2.DenseFeatures at 0x7f5b751e4730>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "preprocessing_layer = tf.keras.layers.DenseFeatures(categorical_columns+numerical_columns)\n",
    "preprocessing_layer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "layers = [preprocessing_layer]\n",
    "for i in [128,64,32]:\n",
    "    layers.append(tf.keras.layers.Dense(i, activation='relu'))\n",
    "layers.append(tf.keras.layers.Dense(1, activation='sigmoid'))\n",
    "model = tf.keras.Sequential(layers)\n",
    "model.compile(\n",
    "    loss='binary_crossentropy',\n",
    "    optimizer='adam',\n",
    "    metrics=['accuracy'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/50\n",
      "WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'collections.OrderedDict'> input: OrderedDict([('rsi_6', <tf.Tensor 'ExpandDims_65:0' shape=(128, 1) dtype=float32>), ('rsi_12', <tf.Tensor 'ExpandDims_63:0' shape=(128, 1) dtype=float32>), ('rsi_24', <tf.Tensor 'ExpandDims_64:0' shape=(128, 1) dtype=float32>), ('stoch_k', <tf.Tensor 'ExpandDims_68:0' shape=(128, 1) dtype=float32>), ('stoch_d', <tf.Tensor 'ExpandDims_66:0' shape=(128, 1) dtype=float32>), ('stoch_j', <tf.Tensor 'ExpandDims_67:0' shape=(128, 1) dtype=float32>), ('BBP', <tf.Tensor 'ExpandDims:0' shape=(128, 1) dtype=float32>), ('BLOW_HIGH', <tf.Tensor 'ExpandDims_1:0' shape=(128, 1) dtype=float32>), ('macd', <tf.Tensor 'ExpandDims_56:0' shape=(128, 1) dtype=float32>), ('macdsignal', <tf.Tensor 'ExpandDims_58:0' shape=(128, 1) dtype=float32>), ('macdhist', <tf.Tensor 'ExpandDims_57:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_5', <tf.Tensor 'ExpandDims_44:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_13', <tf.Tensor 'ExpandDims_38:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_21', <tf.Tensor 'ExpandDims_40:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_34', <tf.Tensor 'ExpandDims_42:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_55', <tf.Tensor 'ExpandDims_45:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_89', <tf.Tensor 'ExpandDims_46:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_144', <tf.Tensor 'ExpandDims_39:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_233', <tf.Tensor 'ExpandDims_41:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_377', <tf.Tensor 'ExpandDims_43:0' shape=(128, 1) dtype=float32>), ('SMA_5_13_DIFF', <tf.Tensor 'ExpandDims_27:0' shape=(128, 1) dtype=float32>), ('SMA_5_21_DIFF', <tf.Tensor 'ExpandDims_29:0' shape=(128, 1) dtype=float32>), ('SMA_5_34_DIFF', <tf.Tensor 'ExpandDims_31:0' shape=(128, 1) dtype=float32>), ('SMA_5_55_DIFF', <tf.Tensor 'ExpandDims_33:0' shape=(128, 1) dtype=float32>), ('SMA_5_89_DIFF', <tf.Tensor 'ExpandDims_34:0' shape=(128, 1) dtype=float32>), ('SMA_5_144_DIFF', <tf.Tensor 'ExpandDims_28:0' shape=(128, 1) dtype=float32>), ('SMA_5_233_DIFF', <tf.Tensor 'ExpandDims_30:0' shape=(128, 1) dtype=float32>), ('SMA_5_377_DIFF', <tf.Tensor 'ExpandDims_32:0' shape=(128, 1) dtype=float32>), ('SMA_13_21_DIFF', <tf.Tensor 'ExpandDims_3:0' shape=(128, 1) dtype=float32>), ('SMA_13_34_DIFF', <tf.Tensor 'ExpandDims_5:0' shape=(128, 1) dtype=float32>), ('SMA_13_55_DIFF', <tf.Tensor 'ExpandDims_7:0' shape=(128, 1) dtype=float32>), ('SMA_13_89_DIFF', <tf.Tensor 'ExpandDims_8:0' shape=(128, 1) dtype=float32>), ('SMA_13_144_DIFF', <tf.Tensor 'ExpandDims_2:0' shape=(128, 1) dtype=float32>), ('SMA_13_233_DIFF', <tf.Tensor 'ExpandDims_4:0' shape=(128, 1) dtype=float32>), ('SMA_13_377_DIFF', <tf.Tensor 'ExpandDims_6:0' shape=(128, 1) dtype=float32>), ('SMA_21_34_DIFF', <tf.Tensor 'ExpandDims_13:0' shape=(128, 1) dtype=float32>), ('SMA_21_55_DIFF', <tf.Tensor 'ExpandDims_15:0' shape=(128, 1) dtype=float32>), ('SMA_21_89_DIFF', <tf.Tensor 'ExpandDims_16:0' shape=(128, 1) dtype=float32>), ('SMA_21_144_DIFF', <tf.Tensor 'ExpandDims_11:0' shape=(128, 1) dtype=float32>), ('SMA_21_233_DIFF', <tf.Tensor 'ExpandDims_12:0' shape=(128, 1) dtype=float32>), ('SMA_21_377_DIFF', <tf.Tensor 'ExpandDims_14:0' shape=(128, 1) dtype=float32>), ('SMA_34_55_DIFF', <tf.Tensor 'ExpandDims_21:0' shape=(128, 1) dtype=float32>), ('SMA_34_89_DIFF', <tf.Tensor 'ExpandDims_22:0' shape=(128, 1) dtype=float32>), ('SMA_34_144_DIFF', <tf.Tensor 'ExpandDims_18:0' shape=(128, 1) dtype=float32>), ('SMA_34_233_DIFF', <tf.Tensor 'ExpandDims_19:0' shape=(128, 1) dtype=float32>), ('SMA_34_377_DIFF', <tf.Tensor 'ExpandDims_20:0' shape=(128, 1) dtype=float32>), ('SMA_55_89_DIFF', <tf.Tensor 'ExpandDims_26:0' shape=(128, 1) dtype=float32>), ('SMA_55_144_DIFF', <tf.Tensor 'ExpandDims_23:0' shape=(128, 1) dtype=float32>), ('SMA_55_233_DIFF', <tf.Tensor 'ExpandDims_24:0' shape=(128, 1) dtype=float32>), ('SMA_55_377_DIFF', <tf.Tensor 'ExpandDims_25:0' shape=(128, 1) dtype=float32>), ('SMA_89_144_DIFF', <tf.Tensor 'ExpandDims_35:0' shape=(128, 1) dtype=float32>), ('SMA_89_233_DIFF', <tf.Tensor 'ExpandDims_36:0' shape=(128, 1) dtype=float32>), ('SMA_89_377_DIFF', <tf.Tensor 'ExpandDims_37:0' shape=(128, 1) dtype=float32>), ('SMA_144_233_DIFF', <tf.Tensor 'ExpandDims_9:0' shape=(128, 1) dtype=float32>), ('SMA_144_377_DIFF', <tf.Tensor 'ExpandDims_10:0' shape=(128, 1) dtype=float32>), ('SMA_233_377_DIFF', <tf.Tensor 'ExpandDims_17:0' shape=(128, 1) dtype=float32>), ('peTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_61:0' shape=(128, 1) dtype=float32>), ('pbMRQ_377_SMA_diff', <tf.Tensor 'ExpandDims_59:0' shape=(128, 1) dtype=float32>), ('psTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_62:0' shape=(128, 1) dtype=float32>), ('pcfNcfTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_60:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_5', <tf.Tensor 'ExpandDims_53:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_13', <tf.Tensor 'ExpandDims_47:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_21', <tf.Tensor 'ExpandDims_49:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_34', <tf.Tensor 'ExpandDims_51:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_55', <tf.Tensor 'ExpandDims_54:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_89', <tf.Tensor 'ExpandDims_55:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_144', <tf.Tensor 'ExpandDims_48:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_233', <tf.Tensor 'ExpandDims_50:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_377', <tf.Tensor 'ExpandDims_52:0' shape=(128, 1) dtype=float32>)])\n",
      "Consider rewriting this model with the Functional API.\n",
      "WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'collections.OrderedDict'> input: OrderedDict([('rsi_6', <tf.Tensor 'ExpandDims_65:0' shape=(128, 1) dtype=float32>), ('rsi_12', <tf.Tensor 'ExpandDims_63:0' shape=(128, 1) dtype=float32>), ('rsi_24', <tf.Tensor 'ExpandDims_64:0' shape=(128, 1) dtype=float32>), ('stoch_k', <tf.Tensor 'ExpandDims_68:0' shape=(128, 1) dtype=float32>), ('stoch_d', <tf.Tensor 'ExpandDims_66:0' shape=(128, 1) dtype=float32>), ('stoch_j', <tf.Tensor 'ExpandDims_67:0' shape=(128, 1) dtype=float32>), ('BBP', <tf.Tensor 'ExpandDims:0' shape=(128, 1) dtype=float32>), ('BLOW_HIGH', <tf.Tensor 'ExpandDims_1:0' shape=(128, 1) dtype=float32>), ('macd', <tf.Tensor 'ExpandDims_56:0' shape=(128, 1) dtype=float32>), ('macdsignal', <tf.Tensor 'ExpandDims_58:0' shape=(128, 1) dtype=float32>), ('macdhist', <tf.Tensor 'ExpandDims_57:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_5', <tf.Tensor 'ExpandDims_44:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_13', <tf.Tensor 'ExpandDims_38:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_21', <tf.Tensor 'ExpandDims_40:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_34', <tf.Tensor 'ExpandDims_42:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_55', <tf.Tensor 'ExpandDims_45:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_89', <tf.Tensor 'ExpandDims_46:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_144', <tf.Tensor 'ExpandDims_39:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_233', <tf.Tensor 'ExpandDims_41:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_377', <tf.Tensor 'ExpandDims_43:0' shape=(128, 1) dtype=float32>), ('SMA_5_13_DIFF', <tf.Tensor 'ExpandDims_27:0' shape=(128, 1) dtype=float32>), ('SMA_5_21_DIFF', <tf.Tensor 'ExpandDims_29:0' shape=(128, 1) dtype=float32>), ('SMA_5_34_DIFF', <tf.Tensor 'ExpandDims_31:0' shape=(128, 1) dtype=float32>), ('SMA_5_55_DIFF', <tf.Tensor 'ExpandDims_33:0' shape=(128, 1) dtype=float32>), ('SMA_5_89_DIFF', <tf.Tensor 'ExpandDims_34:0' shape=(128, 1) dtype=float32>), ('SMA_5_144_DIFF', <tf.Tensor 'ExpandDims_28:0' shape=(128, 1) dtype=float32>), ('SMA_5_233_DIFF', <tf.Tensor 'ExpandDims_30:0' shape=(128, 1) dtype=float32>), ('SMA_5_377_DIFF', <tf.Tensor 'ExpandDims_32:0' shape=(128, 1) dtype=float32>), ('SMA_13_21_DIFF', <tf.Tensor 'ExpandDims_3:0' shape=(128, 1) dtype=float32>), ('SMA_13_34_DIFF', <tf.Tensor 'ExpandDims_5:0' shape=(128, 1) dtype=float32>), ('SMA_13_55_DIFF', <tf.Tensor 'ExpandDims_7:0' shape=(128, 1) dtype=float32>), ('SMA_13_89_DIFF', <tf.Tensor 'ExpandDims_8:0' shape=(128, 1) dtype=float32>), ('SMA_13_144_DIFF', <tf.Tensor 'ExpandDims_2:0' shape=(128, 1) dtype=float32>), ('SMA_13_233_DIFF', <tf.Tensor 'ExpandDims_4:0' shape=(128, 1) dtype=float32>), ('SMA_13_377_DIFF', <tf.Tensor 'ExpandDims_6:0' shape=(128, 1) dtype=float32>), ('SMA_21_34_DIFF', <tf.Tensor 'ExpandDims_13:0' shape=(128, 1) dtype=float32>), ('SMA_21_55_DIFF', <tf.Tensor 'ExpandDims_15:0' shape=(128, 1) dtype=float32>), ('SMA_21_89_DIFF', <tf.Tensor 'ExpandDims_16:0' shape=(128, 1) dtype=float32>), ('SMA_21_144_DIFF', <tf.Tensor 'ExpandDims_11:0' shape=(128, 1) dtype=float32>), ('SMA_21_233_DIFF', <tf.Tensor 'ExpandDims_12:0' shape=(128, 1) dtype=float32>), ('SMA_21_377_DIFF', <tf.Tensor 'ExpandDims_14:0' shape=(128, 1) dtype=float32>), ('SMA_34_55_DIFF', <tf.Tensor 'ExpandDims_21:0' shape=(128, 1) dtype=float32>), ('SMA_34_89_DIFF', <tf.Tensor 'ExpandDims_22:0' shape=(128, 1) dtype=float32>), ('SMA_34_144_DIFF', <tf.Tensor 'ExpandDims_18:0' shape=(128, 1) dtype=float32>), ('SMA_34_233_DIFF', <tf.Tensor 'ExpandDims_19:0' shape=(128, 1) dtype=float32>), ('SMA_34_377_DIFF', <tf.Tensor 'ExpandDims_20:0' shape=(128, 1) dtype=float32>), ('SMA_55_89_DIFF', <tf.Tensor 'ExpandDims_26:0' shape=(128, 1) dtype=float32>), ('SMA_55_144_DIFF', <tf.Tensor 'ExpandDims_23:0' shape=(128, 1) dtype=float32>), ('SMA_55_233_DIFF', <tf.Tensor 'ExpandDims_24:0' shape=(128, 1) dtype=float32>), ('SMA_55_377_DIFF', <tf.Tensor 'ExpandDims_25:0' shape=(128, 1) dtype=float32>), ('SMA_89_144_DIFF', <tf.Tensor 'ExpandDims_35:0' shape=(128, 1) dtype=float32>), ('SMA_89_233_DIFF', <tf.Tensor 'ExpandDims_36:0' shape=(128, 1) dtype=float32>), ('SMA_89_377_DIFF', <tf.Tensor 'ExpandDims_37:0' shape=(128, 1) dtype=float32>), ('SMA_144_233_DIFF', <tf.Tensor 'ExpandDims_9:0' shape=(128, 1) dtype=float32>), ('SMA_144_377_DIFF', <tf.Tensor 'ExpandDims_10:0' shape=(128, 1) dtype=float32>), ('SMA_233_377_DIFF', <tf.Tensor 'ExpandDims_17:0' shape=(128, 1) dtype=float32>), ('peTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_61:0' shape=(128, 1) dtype=float32>), ('pbMRQ_377_SMA_diff', <tf.Tensor 'ExpandDims_59:0' shape=(128, 1) dtype=float32>), ('psTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_62:0' shape=(128, 1) dtype=float32>), ('pcfNcfTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_60:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_5', <tf.Tensor 'ExpandDims_53:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_13', <tf.Tensor 'ExpandDims_47:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_21', <tf.Tensor 'ExpandDims_49:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_34', <tf.Tensor 'ExpandDims_51:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_55', <tf.Tensor 'ExpandDims_54:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_89', <tf.Tensor 'ExpandDims_55:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_144', <tf.Tensor 'ExpandDims_48:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_233', <tf.Tensor 'ExpandDims_50:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_377', <tf.Tensor 'ExpandDims_52:0' shape=(128, 1) dtype=float32>)])\n",
      "Consider rewriting this model with the Functional API.\n",
      "1/1 [==============================] - ETA: 0s - loss: 2.7650 - accuracy: 0.4141WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a <class 'collections.OrderedDict'> input: OrderedDict([('rsi_6', <tf.Tensor 'ExpandDims_65:0' shape=(128, 1) dtype=float32>), ('rsi_12', <tf.Tensor 'ExpandDims_63:0' shape=(128, 1) dtype=float32>), ('rsi_24', <tf.Tensor 'ExpandDims_64:0' shape=(128, 1) dtype=float32>), ('stoch_k', <tf.Tensor 'ExpandDims_68:0' shape=(128, 1) dtype=float32>), ('stoch_d', <tf.Tensor 'ExpandDims_66:0' shape=(128, 1) dtype=float32>), ('stoch_j', <tf.Tensor 'ExpandDims_67:0' shape=(128, 1) dtype=float32>), ('BBP', <tf.Tensor 'ExpandDims:0' shape=(128, 1) dtype=float32>), ('BLOW_HIGH', <tf.Tensor 'ExpandDims_1:0' shape=(128, 1) dtype=float32>), ('macd', <tf.Tensor 'ExpandDims_56:0' shape=(128, 1) dtype=float32>), ('macdsignal', <tf.Tensor 'ExpandDims_58:0' shape=(128, 1) dtype=float32>), ('macdhist', <tf.Tensor 'ExpandDims_57:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_5', <tf.Tensor 'ExpandDims_44:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_13', <tf.Tensor 'ExpandDims_38:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_21', <tf.Tensor 'ExpandDims_40:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_34', <tf.Tensor 'ExpandDims_42:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_55', <tf.Tensor 'ExpandDims_45:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_89', <tf.Tensor 'ExpandDims_46:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_144', <tf.Tensor 'ExpandDims_39:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_233', <tf.Tensor 'ExpandDims_41:0' shape=(128, 1) dtype=float32>), ('SMA_DIFF_377', <tf.Tensor 'ExpandDims_43:0' shape=(128, 1) dtype=float32>), ('SMA_5_13_DIFF', <tf.Tensor 'ExpandDims_27:0' shape=(128, 1) dtype=float32>), ('SMA_5_21_DIFF', <tf.Tensor 'ExpandDims_29:0' shape=(128, 1) dtype=float32>), ('SMA_5_34_DIFF', <tf.Tensor 'ExpandDims_31:0' shape=(128, 1) dtype=float32>), ('SMA_5_55_DIFF', <tf.Tensor 'ExpandDims_33:0' shape=(128, 1) dtype=float32>), ('SMA_5_89_DIFF', <tf.Tensor 'ExpandDims_34:0' shape=(128, 1) dtype=float32>), ('SMA_5_144_DIFF', <tf.Tensor 'ExpandDims_28:0' shape=(128, 1) dtype=float32>), ('SMA_5_233_DIFF', <tf.Tensor 'ExpandDims_30:0' shape=(128, 1) dtype=float32>), ('SMA_5_377_DIFF', <tf.Tensor 'ExpandDims_32:0' shape=(128, 1) dtype=float32>), ('SMA_13_21_DIFF', <tf.Tensor 'ExpandDims_3:0' shape=(128, 1) dtype=float32>), ('SMA_13_34_DIFF', <tf.Tensor 'ExpandDims_5:0' shape=(128, 1) dtype=float32>), ('SMA_13_55_DIFF', <tf.Tensor 'ExpandDims_7:0' shape=(128, 1) dtype=float32>), ('SMA_13_89_DIFF', <tf.Tensor 'ExpandDims_8:0' shape=(128, 1) dtype=float32>), ('SMA_13_144_DIFF', <tf.Tensor 'ExpandDims_2:0' shape=(128, 1) dtype=float32>), ('SMA_13_233_DIFF', <tf.Tensor 'ExpandDims_4:0' shape=(128, 1) dtype=float32>), ('SMA_13_377_DIFF', <tf.Tensor 'ExpandDims_6:0' shape=(128, 1) dtype=float32>), ('SMA_21_34_DIFF', <tf.Tensor 'ExpandDims_13:0' shape=(128, 1) dtype=float32>), ('SMA_21_55_DIFF', <tf.Tensor 'ExpandDims_15:0' shape=(128, 1) dtype=float32>), ('SMA_21_89_DIFF', <tf.Tensor 'ExpandDims_16:0' shape=(128, 1) dtype=float32>), ('SMA_21_144_DIFF', <tf.Tensor 'ExpandDims_11:0' shape=(128, 1) dtype=float32>), ('SMA_21_233_DIFF', <tf.Tensor 'ExpandDims_12:0' shape=(128, 1) dtype=float32>), ('SMA_21_377_DIFF', <tf.Tensor 'ExpandDims_14:0' shape=(128, 1) dtype=float32>), ('SMA_34_55_DIFF', <tf.Tensor 'ExpandDims_21:0' shape=(128, 1) dtype=float32>), ('SMA_34_89_DIFF', <tf.Tensor 'ExpandDims_22:0' shape=(128, 1) dtype=float32>), ('SMA_34_144_DIFF', <tf.Tensor 'ExpandDims_18:0' shape=(128, 1) dtype=float32>), ('SMA_34_233_DIFF', <tf.Tensor 'ExpandDims_19:0' shape=(128, 1) dtype=float32>), ('SMA_34_377_DIFF', <tf.Tensor 'ExpandDims_20:0' shape=(128, 1) dtype=float32>), ('SMA_55_89_DIFF', <tf.Tensor 'ExpandDims_26:0' shape=(128, 1) dtype=float32>), ('SMA_55_144_DIFF', <tf.Tensor 'ExpandDims_23:0' shape=(128, 1) dtype=float32>), ('SMA_55_233_DIFF', <tf.Tensor 'ExpandDims_24:0' shape=(128, 1) dtype=float32>), ('SMA_55_377_DIFF', <tf.Tensor 'ExpandDims_25:0' shape=(128, 1) dtype=float32>), ('SMA_89_144_DIFF', <tf.Tensor 'ExpandDims_35:0' shape=(128, 1) dtype=float32>), ('SMA_89_233_DIFF', <tf.Tensor 'ExpandDims_36:0' shape=(128, 1) dtype=float32>), ('SMA_89_377_DIFF', <tf.Tensor 'ExpandDims_37:0' shape=(128, 1) dtype=float32>), ('SMA_144_233_DIFF', <tf.Tensor 'ExpandDims_9:0' shape=(128, 1) dtype=float32>), ('SMA_144_377_DIFF', <tf.Tensor 'ExpandDims_10:0' shape=(128, 1) dtype=float32>), ('SMA_233_377_DIFF', <tf.Tensor 'ExpandDims_17:0' shape=(128, 1) dtype=float32>), ('peTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_61:0' shape=(128, 1) dtype=float32>), ('pbMRQ_377_SMA_diff', <tf.Tensor 'ExpandDims_59:0' shape=(128, 1) dtype=float32>), ('psTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_62:0' shape=(128, 1) dtype=float32>), ('pcfNcfTTM_377_SMA_diff', <tf.Tensor 'ExpandDims_60:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_5', <tf.Tensor 'ExpandDims_53:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_13', <tf.Tensor 'ExpandDims_47:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_21', <tf.Tensor 'ExpandDims_49:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_34', <tf.Tensor 'ExpandDims_51:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_55', <tf.Tensor 'ExpandDims_54:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_89', <tf.Tensor 'ExpandDims_55:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_144', <tf.Tensor 'ExpandDims_48:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_233', <tf.Tensor 'ExpandDims_50:0' shape=(128, 1) dtype=float32>), ('VOL_SMA_DIFF_377', <tf.Tensor 'ExpandDims_52:0' shape=(128, 1) dtype=float32>)])\n",
      "Consider rewriting this model with the Functional API.\n"
     ]
    }
   ],
   "source": [
    "# train_data = dataset.shuffle(500)\n",
    "# test_data = raw_test_data\n",
    "# model.fit(train_dataset, validation_data = val_dataset, epochs=500, steps_per_epoch = 1, validation_steps = 1000)\n",
    "model.fit(train_dataset, validation_data=val_dataset, epochs=50, steps_per_epoch = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
